import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, mergeProps } from "vue";
var index_vue_vue_type_style_index_0_scoped_true_lang = "";
var _export_sfc = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const _hoisted_1 = { class: "choose-time" };
const _hoisted_2 = { class: "start-time" };
const _hoisted_3 = { class: "end-time" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  name: "index",
  props: {
    startPlaceholder: { default: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65F6\u95F4" },
    endPlaceholder: { default: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65F6\u95F4" },
    startTimeStart: { default: "08:00" },
    startStep: { default: "00:30" },
    startTimeEnd: { default: "24:00" },
    endTimeStart: { default: "08:00" },
    endStep: { default: "00:30" },
    endTimeEnd: { default: "24:00" }
  },
  emits: ["changeStartTime", "onChange"],
  setup(__props, { emit: emits }) {
    const startTime = ref("");
    const endTime = ref("");
    const endTimeDisable = ref(true);
    watch(() => startTime.value, (val) => {
      if (val === "") {
        endTime.value = "";
        endTimeDisable.value = true;
        return;
      }
      endTimeDisable.value = false;
      emits("changeStartTime", val);
    });
    watch(() => endTime.value, (val) => {
      if (val === "")
        return;
      emits("onChange", {
        startTime: startTime.value,
        endTime: val
      });
    });
    return (_ctx, _cache) => {
      const _component_el_time_select = resolveComponent("el-time-select");
      return openBlock(), createElementBlock("div", null, [
        createElementVNode("div", _hoisted_1, [
          createElementVNode("div", _hoisted_2, [
            createVNode(_component_el_time_select, mergeProps({
              modelValue: startTime.value,
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => startTime.value = $event),
              placeholder: __props.startPlaceholder,
              start: __props.startTimeStart,
              end: __props.startTimeEnd,
              step: __props.startStep
            }, _ctx.$attrs.startOptions), null, 16, ["modelValue", "placeholder", "start", "end", "step"])
          ]),
          createElementVNode("div", _hoisted_3, [
            createVNode(_component_el_time_select, mergeProps({
              modelValue: endTime.value,
              "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => endTime.value = $event),
              placeholder: __props.endPlaceholder,
              start: __props.endTimeStart,
              end: __props.endTimeEnd,
              step: __props.endStep,
              disabled: endTimeDisable.value,
              "min-time": startTime.value
            }, _ctx.$attrs.endOptions), null, 16, ["modelValue", "placeholder", "start", "end", "step", "disabled", "min-time"])
          ])
        ])
      ]);
    };
  }
});
var chooseTIme = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2227e00e"]]);
var index = {
  install(app) {
    app.component("MnChooseTime", chooseTIme);
  }
};
export { index as default };
